package com.gufe.controller.admin.veteran;

import com.gufe.entity.VMQueryParam;
import com.gufe.result.PageResult;
import com.gufe.result.Result;
import com.gufe.service.admin.veteran.VeteranMemberService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;

@RequestMapping("/admin/veteran")
@RestController
@Slf4j
public class VeteranMemberController {
    @Autowired
    private VeteranMemberService veteranMemberService;

    // 分页条件查询退伍人员信息
    @GetMapping("/member-info")
    public Result getVeteranMemberInfo(VMQueryParam vmQueryParam) {
        log.info("获取退伍人员信息");
        PageResult pageResult = veteranMemberService.getMemberInfo(vmQueryParam);
        return Result.success(pageResult);
    }


    /**
     * 导入退伍人员信息表Excel
     **/
    @PostMapping( "/import-excel/veteran")
    public Result excelProTbZbzs(@RequestParam("file") MultipartFile file) {
        log.info("从Excel中导入退伍人员信息");
        String importResult = veteranMemberService.importExcelVeteran(file);
        return Result.success(importResult);

    }
}
